# New ports collection makefile for: py-hotot
# Date created:		2011-02-21
# Whom:		Olivier Duchateau <duchateau.olivier@gmail.com>
#
# $FreeBSD: $
#

PORTNAME=	hotot
PORTVERSION=	0.9.6
PORTREVISION=	12
CATEGORIES=	net-im python
MASTER_SITES=	http://avignu.tuxfamily.org/FreeBSD/distfiles/
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
DISTNAME=	${PORTNAME}-${PORTVERSION}~hg991

MAINTAINER=	duchateau.olivier@gmail.com
COMMENT=	Twitter and Identi.ca microblogging client

BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}distutils-extra>=2.23:${PORTSDIR}/devel/py-distutils-extra
RUN_DEPENDS=	${PYTHON_SITELIBDIR}/setproctitle.so:${PORTSDIR}/devel/py-setproctitle \
		${PYTHON_SITELIBDIR}/keybinder/__init__.py:${PORTSDIR}/x11/keybinder \
		${LOCALBASE}/libdata/pkgconfig/pywebkitgtk-1.0.pc:${PORTSDIR}/www/py-webkitgtk \
		${LOCALBASE}/libdata/pkgconfig/notify-python.pc:${PORTSDIR}/devel/py-notify \
		${LOCALBASE}/lib/X11/fonts/dejavu/DejaVuSans.ttf:${PORTSDIR}/x11-fonts/dejavu

WRKSRC=	${WRKDIR}/${PORTNAME}-${PORTVERSION}

USE_PYTHON=	yes
USE_PYDISTUTILS=	yes
USE_GNOME=	desktopfileutils
INSTALLS_ICONS=	yes
REINPLACE_ARGS=	-i ""

# Locale (en, zh_CN or fr)
HOTOT_LOCALE?=	en

OPTIONS=	PYCURL "Install Python bindings for cURL" off

.include <bsd.port.pre.mk>

.if defined(PYCURL)
RUN_DEPENDS+=	${PYTHON_SITELIBDIR}/curl/__init__.py:${PORTSDIR}/ftp/py-curl
.endif

post-extract:
	cd ${WRKSRC} && ${MKDIR} -p data/_locales/fr
	@${CP} ${FILESDIR}/messages.json ${WRKSRC}/data/_locales/fr

post-patch:
.for LOCALE in de fr it tr
	${MV} ${WRKSRC}/po/${LOCALE}_* ${WRKSRC}/po/${LOCALE}.po
.endfor

	${REINPLACE_CMD} -e "s|default_locale: 'en'|default_locale: '${HOTOT_LOCALE}'| ; \
		s|locale: 'en'|locale: '${HOTOT_LOCALE}'|" ${WRKSRC}/data/js/i18n.js

do-build:
	@cd ${WRKSRC} && \
		${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} build_i18n -m ; \
		${SETENV} ${MAKE_ENV} ${PYTHON_CMD} ${PYSETUP} build

post-build:
	@cd ${WRKSRC} && \
		${FIND} . -type f -name '*.orig' -exec ${RM} -f {} \;

post-install:
	@-update-desktop-database

.include <bsd.port.post.mk>
